<template>
	<view class="layer tp-clear">
		<view class="menu-list" v-for="(item,index) in menuList" :key="index">
			<view class="menu-list-child" @click="goDetails(item.id)">
				<view class="ico-layer">
					<image class="ico" mode="aspectFit" v-if="item.ico" :src="item.ico" :lazy-load="true"></image>
				</view>
				<text class="span">{{ item.name }}</text>
			</view>
		</view>
	</view>
</template>

<script>
	import { menuApi } from 'static/services/mineServices';
  	import shareMixin from '@/common/mixins/shareMixin.js';
	import { toDate } from 'static/resource/until.js';
	export default {
    	mixins: [shareMixin],
		data() {
			return {
				menuList: []
			}
		},
		onReady(val){
		},
		onShow(val){
		},
		onLoad(val) {
			this.init();
		},
		methods: {
			init(){
				this.menuApi();
			},
			menuApi(){
				menuApi().then(res=>{
					if(res){
						this.menuList = res.menuList;
					}
				})
			},
			// 跳转列表
			goDetails(val){
				this.goPage('/subPackages/menu-list/index?id=' + val);
			},
		},
		// 分享
		onShareAppMessage(res) {
				return {
				  title: '分类菜单',
				}
		},
		//分享到朋友圈
		onShareTimeline(res) {
				 return {
				  title: '分类菜单',
				}
		},
	}
</script>

<style lang="scss" scoped>
	.layer {
		width: 100%;
		min-height: 100%;
		background: #fff;
		.menu-list{
			width: 25%;
			padding: 16rpx;
			box-sizing: border-box;
			float: left;
			.menu-list-child{
				width: 100%;
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				padding: 14rpx;
				box-sizing: border-box;
				.ico-layer{
					width: 100rpx;
					height: 100rpx;
					.ico{
						width: 100%;
						height: 100%;
					}
				}
				.span{
					color: #000;
					font-size: 28rpx;
					line-height: 48rpx;
					font-weight: 600;
				}
			}
		}
	}

</style>
